package com.sc.nft.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sc.nft.entity.MallUserPropsReleasedDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

@Mapper
public interface MallUserPropsReleasedDetailMapper extends BaseMapper<MallUserPropsReleasedDetail> {

    @Select("SELECT * FROM sc_mall_user_props_released_detail " +
            "WHERE user_id = #{userId} " +
            "AND props_id = #{propsId} " +
            "AND dao_id = #{daoId} " +
            "ORDER BY create_time DESC " +
            "LIMIT 1")
    MallUserPropsReleasedDetail getLastReleasedDetail(@Param("userId") Long userId,
                                                      @Param("propsId") Long propsId,
                                                      @Param("daoId") Long daoId);


    List<MallUserPropsReleasedDetail> getReleasedSummaryList(
            @Param("startTime") Date startTime,
            @Param("endTime") Date endTime,
            @Param("userId") Long userId,
            @Param("daoId") Long daoId,
            @Param("propsIds") List<Long> propsIds
    );

    MallUserPropsReleasedDetail getReleasedSummary(
            @Param("startTime") Date startTime,
            @Param("endTime") Date endTime,
            @Param("userId") Long userId,
            @Param("daoId") Long daoId,
            @Param("propsIds") List<Long> propsIds
    );
}